package com.fenqing.leetcode.code.t200_300;

import com.fenqing.annotations.Execute;
import com.fenqing.core.Topic;

import java.util.Arrays;

/**
 * @author fenqing
 */
public class Topic283 extends Topic {
    /**
     * 构造器
     *
     * @param input 输入
     */
    public Topic283(String input) {
        super(input);
    }

    @Execute
    public void moveZeroes(int[] nums) {
        int index = 0, index2 = 0;
        while (index2 < nums.length) {
            if (nums[index2] != 0) {
                nums[index] = nums[index2];
                index++;
            }
            index2++;
        }
        for (int i = index; i < nums.length; i++) {
            nums[i] = 0;
        }
    }

    public static void main(String[] args) {
        Topic283 topic283 = new Topic283("[0,1,0,3,12]");
        topic283.run();
        int[] object = topic283.getObject(0);
        System.out.println(Arrays.toString(object));
    }
}
